# 导包
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

# 获取浏览器驱动
driver = webdriver.Firefox()
# 打开测试的网址
url = 'file:///C:/Users/tedu/Desktop/NSD2407/html/registerA.html'
driver.get(url)

# CSS定位
# 基于CSS选择器
# username = driver.find_element(By.CSS_SELECTOR, '#userA')
# username = driver.find_element(By.CSS_SELECTOR, '#p1>input')
username = driver.find_element(By.CSS_SELECTOR, '[name="userA"]')
username.send_keys('admin')
# 使用CSS定位密码，邮箱，电话并输入值，最后点击按钮
password = driver.find_element(By.CSS_SELECTOR, '#passwordA')
password.send_keys('123456')
tel = driver.find_element(By.CSS_SELECTOR, '.telA')
tel.send_keys('19988889999')
email = driver.find_element(By.CSS_SELECTOR, '#emailA')
email.send_keys('123@qq.com')

sleep(3)
driver.find_element(By.CSS_SELECTOR, '[value="注册A"]').click()

# 停顿3秒，关闭浏览器
sleep(3)
driver.quit()